package com.commerceE.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;

import com.commerceE.common.exception.ServiceException;
import com.commerceE.dao.ProductTagDao;
import com.commerceE.domain.ProductTag;
import com.commerceE.service.ProductTagService;

public class ProductTagServiceImpl implements ProductTagService{
	
	@Autowired
	private ProductTagDao productTagDao;
	
	public List<ProductTag> getAllListOfProductTag() throws ServiceException{
			return productTagDao.getProductTagListByTagType(null);
	}
	
	public List<ProductTag> getProductTagListByTagType(String tagType) throws ServiceException{
		return productTagDao.getProductTagListByTagType(tagType);
}
	
	@Transactional(readOnly = false, rollbackFor = Exception.class)
	public void insertProductTag(ProductTag productTag) throws ServiceException{
		productTagDao.insert(productTag);
	}
	
	@Transactional(readOnly = false, rollbackFor = Exception.class)
	public void updateProductTag(ProductTag productTag) throws ServiceException{
		productTagDao.update(productTag);
	}
	
	@Transactional(readOnly = false, rollbackFor = Exception.class)
	public void deleteProductTag(ProductTag productTag) throws ServiceException{
		productTagDao.delete(productTag.getProductTagId());
	}

}
